package com.web44.spring;

import com.web44.spring.service.impl.UserBookAllService;
import com.web44.spring.web.UserBookController;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

import java.util.Arrays;
import java.util.List;

/**
 * @Title: AppTest02
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/1/10 15:29
 */
@SpringJUnitConfig(locations = "classpath:beans.xml")
public class AppTest02 {

    @Autowired
    private UserBookController userBookController;
    @Autowired
    private UserBookAllService userBookAllService;

    @Test
    public void func01() {
        int userId = 1;
        int bookId = 1; // 2 够用  1  差30
        userBookController.buy(userId,bookId);
    }

    @Test
    public void func02() {
        List<Integer> userIds = Arrays.asList(1,1);
        int bookId = 2; // 2 够用  1  差30
        userBookAllService.buyAll(userIds,bookId);
    }
}
